package com.ccnu.sm.aop;/*
 * @author raohj
 * @date 2019/12/1917:14
 * @description 编写最最基础的AOP代码
 */

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class RAOPCode implements MethodInterceptor {
    private static final Log log = LogFactory.getLog(RAOPCode.class);
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        log.debug("测试Basic编码实现AOP------------开始");
        log.debug("被调用的方法为:" + methodInvocation.getMethod().getName());
        String retMsg = (String) methodInvocation.proceed(); // 调用被代理的方法
        log.debug("测试Basic编码实现AOP------------结束");
        return retMsg;
    }
}
